package top.glkj.hms.entity;

import lombok.Data;

import javax.persistence.*;
import java.util.List;

/**
 * @author : xgl
 * @version : 0.0.1
 * @date :2021/3/6 15:47
 */
@Data
@Table(name = "evaluation")
@Entity
public class Evaluation extends BaseEntity{
    /**
     * 评价的房间号
     */
    @OneToOne
    @JoinColumn(name = "room_id", referencedColumnName = "id")
    private Room room;

    /**
     * 评价的订单号
     */

    @JoinColumn(name = "order_form_id", referencedColumnName = "id")
    @OneToOne(targetEntity = OrderForm.class,fetch = FetchType.EAGER)
    private OrderForm orderForm;

    /**
     * 评价的用户
     */
    @OneToOne
    @JoinColumn(name = "user_id", referencedColumnName = "id")
    private User user;

    /**
     * 评分
     */
    private double score;

    /**
     * 评分原因
     */
    private String message;

    /**
     * 评分图片
     */
    @OneToMany(targetEntity = Img.class,fetch = FetchType.EAGER)
    @JoinColumn(name = "img_id", referencedColumnName = "id")
    private List<Img> imgList;

    /**
     * 其他评论
     */
    @OneToOne
    @JoinColumn(name = "parent_id", referencedColumnName = "id")
    private Evaluation parent;
}
